package main

import (
	"fmt"
	"go_dev/day5/homework4/random"
)

func bubble(s []int){
	l := len(s)
	for i := 0; i < l-1; i++ {
		flag := true
		for j := 0; j < l-i-1; j++ {
			if s[j] > s[j+1] {
				s[j], s[j+1] = s[j+1], s[j]
				flag = false
			}
		}
		if flag {
			break
		}
		fmt.Println(s)
	}
}

func main(){
	s := random.RandSlice(20)
	fmt.Println(s)
	bubble(s)
	fmt.Println(s)
}